<%--
 *  File:    FavoriteMenuSummary.jsp
 *  @Author: Rael Zhu
 *  Date:    Wednesday, October 22nd, 2003

 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>

<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>
<%@ page contentType = "text/html;charset=UTF-8" %>

<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  String strModuleName = "UPM";
  String privilegeCode = "Z0505";
%>

<%@include file="/inc/PageDefault.inc"%>
<%@include file="/inc/Security.inc"%>

<html>
<head>
<title>FavoriteMenuSummary</title>

<PageFlow:CheckPageFlow pageName="favoritemenusummary"/>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<script language="JavaScript" src="../../js/ScriptLib.js"></script>
<script language="JavaScript">

function addToFavorite(code)
{
  if (code != "")
  {
    if (!confirm("<%= message.getMessageDesc("SURE_TO_ADD_TO_FAVORITE") %>")) return;
    
    frm.privcode.value = code;
    frm.actionname.value = "add";
    frm.submit();
  }
}

function page_save()
{
  if (frm.numrows.value == 0) return;
  
  document.frm.actionname.value = "save";
  document.frm.target = "_self";
  isRunning = true;
  document.frm.submit();
}

function page_delete()
{
  if (nullChecked(document.frm.deleteids))
  {
    alert('<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>');
    return;
  }
  
  if (!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
  
  document.frm.actionname.value = "delete";
  document.frm.target = "_self";
  isRunning = true;
  document.frm.submit();
}

</script>
</head>
<body>

<form name="frm" method="post" action="../../Dispatcher">
  <input type="hidden" name="pagename" value="favoritemenusummary">
  <input type="hidden" name="actionname">
  
  <input type="hidden" name="privcode" value="">

<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr>
    <td  height="25" class="summary_top">
    
    </td>
  </tr>
  
  <tr><td> 
    <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
      <tr class="deepblue-left" > 
        <td class="title_center" width="27">&nbsp;</td>
        <td class="title_center" ><%= label.getLabelName("L_MenuName") %></td>
        <td class="title_center" width="120"><%= label.getLabelName("L_MenuCode") %></td>
        <td class="title_center" width="120"><%= label.getLabelName("L_FavoritePackage") %></td>
      </tr>
      
      <%
        Vector menuSummary = (Vector)pageContext.getAttribute("favoritemenu");
        if (menuSummary == null) menuSummary = new Vector();
        
        String strClassType = "";
        int i = 0;
      %>
      
      <logic:iterate id="menuItem" collection="<%= menuSummary %>" indexId="columnId">
      <%
        if (columnId.intValue()%2 == 1)
        { strClassType = "td-listrom"; }
        else
        { strClassType = "none"; }
        
        i = columnId.intValue();
        
        int index1 = 0;
        int index2 = 0;
        if (strLanguageCode.equals("cn"))
        {
          index1 = columnId.intValue()*2;
          index2 = columnId.intValue()*2 + 1;
        }
        else
        {
          index1 = columnId.intValue()*2 + 1;
          index2 = columnId.intValue()*2;
        }
        
      %>
      <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'">
        <td><input id="id<%=JspHelper.filterNull( columnId )%>" name="deleteids" type="checkbox" value="<custom:write name="menuItem" property="privilegeid"/>" class="normalradio"></td>
        <td>
          <custom:text name="menuItem" property="privilegename" size="15" command="notnull" module="UPM" label="L_FavoritePackage" needMLC="true" isFirstMLC="true" multiLangType="privilegename" entityId="privilegeid" contentId="favoritemenuid" colIndex="<%= columnId %>"/>
          <a onclick='popup("../../common/Lang.jsp?<%= OvalTools.randomURL() %>&form=frm&module=UPM&mlctype=L_FavoritePackage&nativelanguage=need&schema=ovfavoritemenu&qlname=selectprivilegename&entityid=<custom:write name="menuItem" property="entityid"/>&entitycode=<custom:write name="menuItem" property="privilegeid"/>&entitytype=privilegename&contentid=favoritemenuid&colindex=<%=JspHelper.filterNull( columnId )%>", "newwindow", "height=250, width=320,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no");'><custom:button type="3" label="L_Ln" imgsrc="ln.gif" border="0"/></a>
        </td>
        <td>
          <custom:write name="menuItem" property="privilegecode"/>
        </td>
        <td>
          <custom:select name="menuItem" property="packageid" optionsName="favoritepackage" optionValueKey="favoritemenuid" optionInnerTextKey="labelname" colIndex="<%= new Integer(index1) %>"/>
        </td>
        
        <input type="hidden" name="packageid<%=JspHelper.filterNull( index2 )%>" value="">
      </tr>
      </logic:iterate>
      <%
        i = (i + 1)*2;
        if (menuSummary.size() == 0)
        { i = 0; }
      %>
      <input type="hidden" name="numrows" value="<%=JspHelper.filterNull( i )%>">
      
      </table>
      
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top"></td>
        </tr>
        <tr> 
          <td class="td_center">
            <a onClick="page_save()"><custom:button type="1" label="L_Save" imgsrc="save.gif" border="0" style="width:60"/></a>
            <a onClick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
</body>
</html>
